package xin.altitude.spring.mybatisplus.joinquery.one2more.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import xin.altitude.spring.mybatisplus.joinquery.one2more.entity.vo.UserVo;
import xin.altitude.spring.mybatisplus.joinquery.one2more.service.impl.UserService;

import java.util.List;

/**
 * @Author explore
 * @Date 2021/05/24 15:03
 **/
@RestController
public class IndexController {
    @Autowired
    private UserService userService;
    
    // @Autowired
    // private DeptService deptService;
    
    @GetMapping("/test/index1")
    public UserVo index1() {
        return userService.getOneUser(3);
    }
    
    // @GetMapping("/test/index100")
    // public UserVo index100() {
    //     return userService.getOneUser2(3);
    // }
    
    @GetMapping("/test/index2")
    public List<UserVo> index2() {
        return userService.getUserByList();
    }
    
    // @GetMapping("/test/index22")
    // public List<UserVo> index22() {
    //     return userService.getUserByList2();
    // }
    
    @GetMapping("/test/index3")
    public IPage<UserVo> index3() {
        return userService.getUserByPage(new Page<>());
    }
    
    // @GetMapping("/test/index33")
    // public IPage<UserVo> index33() {
    //     return userService.getUserByPage2(new Page<>());
    // }
    
}
